package cn.iocoder.yudao.module.member.alliance.controller.admin;

import cn.iocoder.yudao.framework.business.basic.controller.DetailController;
import cn.iocoder.yudao.framework.business.basic.controller.PageController;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.alliance.service.AdminCloudAllianceUserService;
import cn.iocoder.yudao.module.member.alliance.vo.AdminCloudAllianceUserQueryDTO;
import cn.iocoder.yudao.module.member.alliance.vo.AdminCloudAllianceUserVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 云盟商信息")
@RestController
@RequestMapping("/member/cloud-alliance-user")
@Validated
public class CloudAllianceUserController implements DetailController<AdminCloudAllianceUserVO, Long>, PageController<AdminCloudAllianceUserVO, AdminCloudAllianceUserQueryDTO> {
    @Resource
    private AdminCloudAllianceUserService adminCloudAllianceUserService;

    @PreAuthorize("@ss.hasAnyRoles('super_admin', 'platform_admin', 'tenant_admin')")
    @Override
    public CommonResult<AdminCloudAllianceUserVO> getDetail(Long id) {
        return success(adminCloudAllianceUserService.getDetail(id));
    }

    @PreAuthorize("@ss.hasAnyRoles('super_admin', 'platform_admin', 'tenant_admin')")
    @Override
    public CommonResult<PageResult<AdminCloudAllianceUserVO>> getPage(Integer pageNo, Integer pageSize, AdminCloudAllianceUserQueryDTO param) {
        return success(adminCloudAllianceUserService.getPage(pageNo, pageSize, param));
    }

}